package cn.bearspark.happening.enumeration;

import cn.bearspark.common.dto.ResponseDTO;

/**
 * 动态模块的失败响应的枚举类
 * <p>
 *
 * @author f
 */
public enum HappeningFailRespEnum {
    DATABASE_EXCEPTION(301, "数据库异常");

    /**
     * 返回一个 T 类型的失败响应
     */
    public <T> ResponseDTO<T> response() {
        return ResponseDTO.fail(this.code, this.msg);
    }

    private final int code;
    private final String msg;

    HappeningFailRespEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
}
